package com.dgshanger.sanhxiaofeisc.ui.person.setting

import com.dgshanger.sanhxiaofeisc.R
import com.dgshanger.sanhxiaofeisc.mvp.contract.EditPayPasswordContract
import com.dgshanger.sanhxiaofeisc.mvp.presenter.EditPayPasswordPresenter
import com.xx.baseuilibrary.mvp.BaseMvpActivity
import kotlinx.android.synthetic.main.activity_edit_pay_pw.*


/**
 * EditPayPasswordActivity
 * 沉迷学习不能自拔
 * Describe：修改,设置支付密码
 * Created by 雷小星🍀 on 2018/4/16 10:50.
 */
class EditPayPasswordActivity : BaseMvpActivity<EditPayPasswordContract.Model, EditPayPasswordContract.View, EditPayPasswordPresenter>(),
        EditPayPasswordContract.View {

    override fun setSendBtnEnable(enable: Boolean) {
        tv_get_code.isEnabled = enable
    }

    override fun setSendBtnText(text: String) {
        tv_get_code.text = text
    }

    override fun createPresenter(): EditPayPasswordPresenter = EditPayPasswordPresenter()

    override val phone: String
        get() = et_phone.text.toString().trim()
    override val new_pwd: String
        get() = et_new_pw.text.toString().trim()
    override val confirm_pwd: String
        get() = et_sure_pw.text.toString().trim()
    override val verify_code: String
        get() = et_vCode.text.toString().trim()

    override fun getActivityLayoutId(): Int = R.layout.activity_edit_pay_pw

    override fun initData() {
    }

    override fun initEvent() {
        tv_get_code.setOnClickListener {
            //发送验证码
            getPresenter().sendCode()
        }
        btn_sure.setOnClickListener {
            //确认修改支付密码
            getPresenter().modifyPaypwd()
        }
    }
}